home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
bbs
/
cddk9606.zip
/
HEADERS.ARJ
/
REBOOT.INT
< prev
next >
Wrap
Text File
|
1996-06-14
|
6KB
|
171 lines
{ ───────────────────────────────────────────────────────────────────────── }
{ REBOOT: Routines to reboot the computer }
{ Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide }
{ ───────────────────────────────────────────────────────────────────────── }
UNIT Reboot;
{$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
{$F+} { . . . . . . . . . . . . . . . . . . . . Force far calls for safety }
{$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
{$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
{$Q-} { . . . . . . . . . . . . . . Do not generate overflow-checking code }
{$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
{$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
{$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
INTERFACE
{#Start}
PROCEDURE GenerateRebootCom(p:pChar);
{
PURPOSE : Generates a COM (executable) file that will invoke a hardware
reset of the CPU.
NOTES : Such a program may be useful if your door uses any external
batch files (i.e. add-on modules) and you wish to give the
sysop the option of rebooting the computer in the event of an
emergency.
This command is very dangerous. Use with care.
EXAMPLE : PROCEDURE MakeBatch;
VAR
Batch : Text;
BEGIN
GenerateRebootCom('REBOOT.COM');
Assign(Batch,'RunIGM.Bat');
Rewrite(Batch);
WriteLn(Batch);
WriteLn(Batch,'REM This is a temporary batch file created');
WriteLn(Batch,'REM by the door when running an IGM. You');
WriteLn(Batch,'REM may safely delete this file if the door');
WriteLn(Batch,'REM is shut down on all nodes.');
WriteLn(Batch);
WriteLn(Batch,'IF %1~ = ~ GOTO Done');
WriteLn(Batch,'%2.EXE %3 %4 %5);
WriteLn(Batch,'IF ERRORLEVEL 69 REBOOT.COM
WriteLn(Batch,':Done');
WriteLn(Batch,'IF FILE EXIST REBOOT.COM DEL REBOOT.COM');
Close(Batch);
END;
SEE ALSO : RebootComputer
}
PROCEDURE RebootComputer(c:Char);
{
PURPOSE : Executes the selected reboot.
PARAMS : ┌─────┬──────────┐
│ c │ Method │
├─────┼──────────┤
│ c │ Cold │
│ h │ Hardware │
│ r │ Hardware │
│ w │ Warm │
└─────┴──────────┘
NOTES : a. The c parameter is not case sensitive.
b. The hardware reset method requires a 286 or later.
c. The cold and warm reboot methods may cause a general
protection fault (GPF) under some multitaskers.
EXAMPLE : BEGIN
WriteLn('WARNING: The computer will now reboot the PC.');
WriteLn('Please shut down all applications, then select');
WriteLn('the desired reboot method.');
WriteLn;
WriteLn(' C = Cold Reboot');
WriteLn(' H = Hardware Reset (286+)');
WriteLn(' W = Warm Reboot (skips memory test)');
WriteLn;
ReadLn(Method);
RebootComputer(Method);
WriteLn('REBOOT FAILURE! Please contact the author.');
END;
SEE ALSO : ColdReboot, HardwareReset, WarmReboot
}
PROCEDURE ColdReboot;
{
PURPOSE : Invokes a cold reboot.
NOTES : A cold reboot is the same as a full reset of the computer
computer system. Compare this to the warm reboot, which
generally skips the initial memory test.
EXAMPLE : BEGIN
SO_pCharLn('Please prepare for a system reboot.');
IF SI_Boolean('Skip initial memory test? ',False) THEN
WarmReboot
ELSE
ColdReboot;
END;
SEE ALSO : RebootComputer, HardwareReset, WarmReboot
}
PROCEDURE HardwareReset;
{
PURPOSE : Uses the 8042 keyboard controller chip to invoke a CPU reset.
This procedure requires a 286+ and an enhanced keyboard.
NOTES : This procedure will bypass your operating system. All
concurrent tasks will be lost. Be sure to warn the operator
before using this (or any other) reboot procedure.
EXAMPLE : BEGIN
IF System.Test8086 > 0 THEN
HardwareReset
ELSE
WriteLn('Error: 286+ not detected.');
END;
SEE ALSO : RebootComputer, ColdReboot, WarmReboot
}
PROCEDURE WarmReboot;
{
PURPOSE : Invokes a warm reboot on the computer system.
NOTES : A warm reboot will the skip the initial memory test on
most computer systems. This procedure may cause problems
in some multitasked and networked enviroments.
EXAMPLE : PROCEDURE SystemHasCrashed;
VAR
Loop : Byte;
BEGIN
WriteLn('The program is unable to recover from a fatal');
WriteLn('error. Rather than return to the BBS and risk');
WriteLn('further damage to your system, the computer will');
WriteLn('now reboot. This will allow your AUTOEXEC.BAT');
WriteLn('file to restart the BBS.');
WriteLn;
FOR Loop:=5 DOWNTO 1 DO
BEGIN
Write(Loop,' ');
Ring;
Delay(1000);
END;
WarmReboot;
END;
SEE ALSO : RebootComputer, ColdBoot, HardwareReset
}
IMPLEMENTATION
{ The source code is available upon registration. }
END.